package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.PostDao;
import com.pti.usermanager.dao.mapper.PostMapper;
import com.pti.usermanager.dao.po.OrgPo;
import com.pti.usermanager.dao.po.PostPo;
import com.pti.usermanager.web.dto.request.SavePostRequest;
import com.pti.usermanager.web.dto.request.UpdatePostRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: PostDaoImpl
 * @Author: dongzhipeng
 * @Description: 岗位数据交换实现层
 * @Date: 2019/1/17
 */
@Repository
public class PostDaoImpl implements PostDao {

    private static final Logger logger = LogManager.getLogger(PostDaoImpl.class);

    @Autowired
    private PostMapper postMapper;

    @Override
    public List<PostPo> findPostByDeptId(Map<String, Object> inputMap) {
        return postMapper.findPostByDeptId(inputMap);
    }

    @Override
    public PostPo findAllByPostId(Long postId) {
        return postMapper.findAllByPostId(postId);
    }

    @Override
    public void savePost(SavePostRequest savePostRequest) {
        postMapper.savePost(savePostRequest);
    }

    @Override
    public void updatePost(UpdatePostRequest updatePostRequest) {
        postMapper.updatePost(updatePostRequest);
    }

    @Override
    public void delPost(Long postId) {
        postMapper.delPost(postId);
    }

    @Override
    public void saveUserByPidAndUid(Long postId, Long usrId) {
        postMapper.saveUserByPidAndUid(postId,usrId);
    }

    @Override
    public void deleteUserByPid(Long postId) {
        postMapper.deleteUserByPid(postId);
    }
}
